charset="UTF-8"



Ext.onReady(function(){

    var button = Ext.get('loginbutton');

    var loginForm = new Ext.FormPanel({    	
    	labelWidth: 75, 
        frame:true,
        bodyStyle:'padding:5px 5px 0',
        width: 300,
        defaults: {width: 250},
        defaultType: 'textfield',

        items: [{
                fieldLabel: '用户名',
                    allowBlank:false,
                    blankText:'不能为空',
                    minLength:4,
                    minLengthText:'最小长度4',
                    maxLength:20,
                    maxLengthText:'最大长度20',
                    id:'username',
                    name: 'username',
                    anchor:'90%'
            },{
                fieldLabel: '密  码',
                    inputType: 'password',
                    allowBlank:false,
                    blankText:'不能为空',
                    minLength:4,
                    minLengthText:'最小长度4',
                    maxLength:20,
                    maxLengthText:'最大长度20',
                    id:'password',
                    name: 'password',
                    anchor:'90%'
            }
        ],
		monitorValid:true,
		onSubmit : Ext.emptyFn, submit : function() { 
			//再次设定action的地址 
			this.getEl().dom.action ='loginPatient.action'; this.getEl().dom.method = 'post'; 
			//提交submit 
			this.getEl().dom.submit(); 
		}, 
        buttons: [{
            text: '登录',
            formBind: true,
            handler:function(){       
				loginForm.getForm().submit(); 
            	
            	
                }
        },{
            text: '重置',
            handler:function(){
					loginForm.form.reset();
                }
        }]
    });
    
        var win = new Ext.Window({
                applyTo:'loginWindow',
                layout:'fit',
                width:300,
                height:150,
                closeAction:'hide',
                plain: true,

                items: [loginForm]

               
            });
    
    button.on('click', function(){
        win.show(this);
    });
});